<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <form id="login" action="2-事件冒泡.html">
        <table>
            <tr>
                <td>
                    用户名
                </td>
                <td><input type="text" id="username" name="username"></td>
                <td>
                    <span>*用户名不为空</span>
                </td>
            </tr>
            <tr>
                <td>
                    密码
                </td>
                <td><input type="password" id="password" name="password">

                </td>
                <td><span>*密码规则</span></td>
            </tr>
            <tr>
                <td>确认密码</td>
                <td><input type="password"></td>
                <td><span>*两次密码要一致</span></td>
            <tr>
                <td colspan="3">
                    <input type="button" onclick="login()" value="注册">

                </td>
            </tr>
            </tr>
        </table>
    </form>
    <script>
    //手动提交form表单
    //需要进行数据验证

    var form= document.getElementById("login");
    form.submit();
    
    </script>
</body>

</html>